package com.yuyou.train.user.service;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.yuyou.train.service.api.lesson.dto.UserClassDTO;
import com.yuyou.train.service.api.lesson.dto.UserLessonTreeDTO;
import com.yuyou.train.service.api.user.entity.User;
import com.yuyou.train.service.api.user.entity.UserLessonProgress;
import com.yuyou.train.user.vo.req.ReqBehavior;
import com.yuyou.train.user.vo.resp.RespGetLessonContent;
import com.yuyou.train.user.vo.resp.RespNextLessonContent;
import com.yuyou.train.user.vo.resp.RespUserInfofiniLes;
import com.yuyou.train.util.bean.ResBoolSimpleInfo;


public interface IUserLessonProgressService {
    int deleteByPrimaryKey(String id);

    int insert(UserLessonProgress record);

    UserLessonProgress selectByPrimaryKey(String id);
    
    List<UserLessonProgress> findUserLessonProgress(UserLessonProgress userLessonProgress);

    int updateByPrimaryKeySelective(UserLessonProgress record);
    
    /**
     * 获取用户当前学习进度
     * @param userId
     * @param classId
     * @return
     * @throws Exception
     */
    UserLessonProgress getUserCurrLesson(String userId,String classId) throws Exception;
    
    /**
     * 获取用户结束课程
     * @param userId
     * @param classId
     * @param endLessonId
     * @return
     * @throws Exception
     */
    UserLessonProgress selectUserEndLesson(String userId, String classId,String endLessonId)throws Exception;
    
    /**
     * 进行下一个章节
     * @param userId
     * @param reqBehavior
     * @return
     */
    ResBoolSimpleInfo<RespNextLessonContent> openUserNextLesson(
    		String userId,String subjectId,ReqBehavior reqBehavior,
    		boolean ignore)throws Exception;
    
	ResBoolSimpleInfo<RespNextLessonContent> openUserNextLessonLock(
			String userId, String subjectId, ReqBehavior reqBehavior,
			boolean ignore) throws Exception;
    
    /**
     * 获取用户学习进度百分比
     * @param userId
     * @param reqBehavior
     * @return
     */
    ResBoolSimpleInfo<Integer> getUserLessonPer(String userId)throws Exception;
    
    /**
     * 插入一个新的过程
     * @param user
     * @param subjectId
     * @return
     */
    ResBoolSimpleInfo<RespNextLessonContent> insertUserNextLesson(User user,String subjectId)throws Exception;
    
    ResBoolSimpleInfo<RespNextLessonContent> solveRule(User user,UserLessonProgress progress,ReqBehavior reqBehavior) throws Exception;
    
    /**
     * 班级详情
     * @param classId
     * @param userId
     * @return
     * @throws Exception
     */
    ResBoolSimpleInfo<UserClassDTO> getUserClass(String classId,String userId)throws Exception ;
    
    
    /**
     * 登录用户课程树
     * @param classId
     * @param userId
     * @param subjectId
     * @return
     */
    List<UserLessonTreeDTO> getUserLessonTree(String classId,String userId )throws Exception;
    
    /**
     * 登录用户课程树（某章）
     * @param classId
     * @param userId
     * @param subjectId
     * @return
     */
    UserLessonTreeDTO getUserchapterTree(String lessonId,String userId )throws Exception;
    
    /**
     * 获取用户下一个章节（叶子）
     * @param classId
     * @param userId
     * @param subjectId
     * @return
     */
    String getUserNextLesson(String classId,String userId,String subjectId)throws Exception;
    
    /**
     * 登录学员课程树节点详细内容
     * @param lessonId
     * @return
     */
    ResBoolSimpleInfo<RespGetLessonContent> getLessonContent(String userId,String loginUserId,String lessonId,String foreignId)throws Exception;
    
    /**
     * 
     * @param userId
     * @param lessonId
     * @return
     */
    UserLessonProgress selectByUserIdAndLessonId(String userId,String lessonId);
    
    
    List<UserLessonProgress> findByUserAttr(String userId,String classId,String isAttr);

    UserLessonProgress getUserFirstLesson(String classId, String userId) throws Exception;

    

}